package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.DishPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

@Mapper
public interface DishMapper {
    @Select("select count(0) from dish where category_id = #{id}")
    int countById(Long id);


    Page<DishVO> query(DishPageQueryDTO dishPageQueryDTO);

    void deleteByIds(List<Long> ids);

    @Select("select  * from dish  where id = #{id}")
    Dish getById(Long id);


    void insert(Dish dish);

    void update(Dish dish);

    List<Dish> getByCategoryId(Dish dish);

    @Update("update dish set status = #{status} where id = #{id}")
    void setStatus(Integer status, Long id);

    Integer countByMap(Map map);
}
